package fun.rockchen.controller;

import fun.rockchen.bean.TaskTotalTimeParam;
import fun.rockchen.bean.TypeDayParamEntity;
import fun.rockchen.service.interfaceService.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @author Rock Chen
 * @Description:
 * @date 2023/10/21 20:12
 */

@RestController
@RequestMapping("/api/statistics")
public class StatisticsController {
    private final StatisticsService statisticsService;

    @Autowired
    public StatisticsController(StatisticsService statisticsService) {
        this.statisticsService = statisticsService;
    }

    @GetMapping
    public ResponseEntity<?> getTypeList(@RequestParam String id) {
        System.out.println(id);
        return statisticsService.getTypeList(id);
    }

    @GetMapping("/typeSevenDay")
    public ResponseEntity<?> getTypeListInSevenDay(@RequestParam String id) {
        return statisticsService.getTypeListInSevenDay(id);
    }

    @GetMapping("/typeDay")
    public ResponseEntity<?> getTypeListDay(@ModelAttribute TypeDayParamEntity typeDayParamEntity) {
        return statisticsService.getTypeListDay(typeDayParamEntity);
    }

    @GetMapping("/taskTotalTime")
    public ResponseEntity<?> getTaskTime(@ModelAttribute TaskTotalTimeParam taskTotalTimeParam) {
        return statisticsService.getTaskTime(taskTotalTimeParam);
    }

    @GetMapping("/tag")
    public ResponseEntity<?> getTag(@RequestParam String userId) {
        return statisticsService.getTag(userId);
    }
}
